# -*- coding: utf-8 -*-
import logging
import time

from weibopy import APIClient, APIError

consumer_key = '3524741974'  #App Key
consumer_secret = '9969c4d6b0b0a45cef0acddadb700703' #App Secret

class WebOAuthHandler(APIClient):
    def get_authorization_url_with_callback(self, callback, signin_with_twitter=False):
        """Get the authorization URL to redirect the user"""
        self.redirect_uri = callback
        return self.get_authorize_url(callback)

weibo_client = None
def get_weibo_client():
    """get oauth handler"""
    global weibo_client
    if not weibo_client:
        weibo_client = WebOAuthHandler(consumer_key, consumer_secret)
    return weibo_client


